import { userInfo } from "os";
import { useState } from "react";
import { useNavigate } from "react-router-dom";
function DbShow(): JSX.Element {

    const [data, setData] = useState([]);
    let nav = useNavigate();

    const goBask = () => {
        nav(-1);
    }

    const logUser = async () => {
        const result = await window.electron.ipcRenderer.invoke("userDao-getAllUsers");
        setData(result)
        console.log(result[0]);
        console.log(result[1]);
        console.log(result[2]);
    }
    return (
        <div>
            我是数据库页面
            <button onClick={goBask}>返回</button>
            <button onClick={logUser}>打印人员表数据</button>
            <ul>
                {
                    data.map((item,index)=>(

                        <li key="index">{item.id}-{item.name}-{item.userName}-{item.age}</li>
                    ))

                }
            </ul>
        </div>
    );
}

export default DbShow;